package de.jaydev.services;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

import de.jaydev.business.Poll;
import de.jaydev.business.PollAnswer;
import de.jaydev.business.PollUserAnswer;
import de.jaydev.business.User;

public class PollService implements IPollService
{
    private List<Poll> polls = new ArrayList<Poll>();
    private List<PollUserAnswer> pollUserAnswers = new ArrayList<PollUserAnswer>();
       
    
    @Override
    public void createPoll(List<PollAnswer> pollanswers, boolean multipleAnswers, List<User> users, Date start, Date end, String question)
    {
        polls.add(new Poll(pollanswers, users, start, end, multipleAnswers, question));
    }
    
    @Override
    public void deletePoll(Poll poll)
    {
       polls.remove(poll);
    }
    
    @Override
    public void answerPoll(User user, Poll poll, List<PollAnswer> pollAnswers)
    {
        pollUserAnswers.add(new PollUserAnswer());
    }
    
    @Override
    public void sendPollReminder(Poll poll)
    {
        System.out.println("sending mail... to ");
        for(User u : poll.getParticipants())
        {
            System.out.println(u.getUsername());
        }
        
    }
    
}
